package com.mhc.suzuki.constant;

/**
 * DESCRIPTION :
 * DATETIME : 2017/5/11 下午2:55
 * @author weifeng
 * @version 1.0.0
 */
public enum SmsTypeEnum {

    //code,属性
    DAILY(0, "测试短信"),
    SYSTEM(1, "系统短信"),
    MARKETING(2, "营销短信"),
    ;
    
    private int code;
    
    private String desc;

    SmsTypeEnum(int code, String desc) {
        this.code = code;
        this.desc = desc;
    }

    public int getCode() {
        return code;
    }

    public String getDesc() {
        return desc;
    }
    
    public static boolean isCorrect(Integer code) {
        if (null == code) {
            return false;
        }
        for (SmsTypeEnum item : SmsTypeEnum.values()) {
            if (item.code == code.intValue()) {
                return true;
            }
        }
        return false;
    }
    
    public static SmsTypeEnum getByCode(int code) {
        for (SmsTypeEnum item : SmsTypeEnum.values()) {
            if (item.code == code) {
                return item;
            }
        }
        return null;
    }
}
